package com.iocup.keybastion.authentication.authenticator;


import lombok.Getter;
import lombok.Setter;

import java.beans.Transient;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 账号密码凭证类
 * @Author: xyjxust
 * @Date: 2022/3/22 11:11
 */
@Setter
@Getter
public class UsernamePasswordCredentials extends LoginCredentials {

    private static final long serialVersionUID = -7229878989627796565L;

    /**
     * 账号
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 其他的一些相关信息
     */
    private Map<String, Object> other = new HashMap<>();


    public UsernamePasswordCredentials putOther(String key, Object value) {
        other.put(key, value);
        return this;
    }

    @Transient
    public <T> T getOther(String key) {
        return (T) other.get(key);
    }

    @Override
    public boolean equals(Object o) {
        return false;
    }

    @Override
    public int hashCode() {
        return 0;
    }
}
